package cn.qzit.panel;

import cn.qzit.label.MineLabel;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;

/**
 * ClassName : cn.qzit.panel.MineField
 * Desc : 雷区
 *
 * @author : LINPQ
 * @date : 2022/4/13 14:45
 */
public class MineField extends JPanel {

    private MineLabel[][] mineLabels;

    public MineField(){


        Border borderIn = BorderFactory.createLoweredBevelBorder();
        Border borderOut = BorderFactory.createEmptyBorder(5,10,10,10);
        Border border = BorderFactory.createCompoundBorder(borderOut,borderIn);
        this.setBorder(border);

        this.setBackground(Color.green);
        mineLabels = new MineLabel[19][19];

        this.setLayout(new GridLayout(19,19));

        for (int i = 0; i < 19; i++) {
            for (int j = 0; j < 19; j++) {
                mineLabels[i][j] =  new MineLabel();
                mineLabels[i][j].setIcon(new ImageIcon("./picture/blank.gif"));


                this.add(mineLabels[i][j]);
            }
        }

    }
}
